package com.cws.project.cws.clazz.service.impl;

import java.util.List;

import com.cws.common.utils.text.Convert;
import com.cws.project.cws.clazz.domain.ClazzUser;
import com.cws.project.cws.clazz.mapper.ClazzUserMapper;
import com.cws.project.cws.clazz.service.IClazzUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 班级用户关联Service业务层处理
 *
 * @author xyl
 * @date 2021-12-21
 */
@Service
public class ClazzUserServiceImpl implements IClazzUserService {
    @Autowired
    private ClazzUserMapper clazzUserMapper;

    /**
     * 查询班级用户关联
     *
     * @param clazzId 班级用户关联ID
     * @return 班级用户关联
     */
    @Override
    public ClazzUser selectClazzUserById(Long clazzId) {
        return clazzUserMapper.selectClazzUserById(clazzId);
    }

    /**
     * 查询班级用户关联列表
     *
     * @param clazzUser 班级用户关联
     * @return 班级用户关联
     */
    @Override
    public List<ClazzUser> selectClazzUserList(ClazzUser clazzUser) {
        return clazzUserMapper.selectClazzUserList(clazzUser);
    }

    /**
     * 新增班级用户关联
     *
     * @param clazzUser 班级用户关联
     * @return 结果
     */
    @Override
    public int insertClazzUser(ClazzUser clazzUser) {
        return clazzUserMapper.insertClazzUser(clazzUser);
    }

    /**
     * 修改班级用户关联
     *
     * @param clazzUser 班级用户关联
     * @return 结果
     */
    @Override
    public int updateClazzUser(ClazzUser clazzUser) {
        return clazzUserMapper.updateClazzUser(clazzUser);
    }

    /**
     * 删除班级用户关联对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteClazzUserByIds(String ids) {
        return clazzUserMapper.deleteClazzUserByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除班级用户关联信息
     *
     * @param clazzId 班级用户关联ID
     * @return 结果
     */
    @Override
    public int deleteClazzUserById(Long clazzId) {
        return clazzUserMapper.deleteClazzUserById(clazzId);
    }

    @Override
    public ClazzUser selectClazzUserByStudentId(Long userId) {
        return clazzUserMapper.selectClazzUserByStudentId(userId);
    }
}
